#pragma once

#include <string>

struct WSA
{
    WSA();
    ~WSA();
};

enum class SOCK_TYPE
{
    RAW,
    TCP,
    UDP,
};

struct recv_data
{
    std::string data;
    std::string host;
    int port;
};

class socket_t
{
    public:
        socket_t();
        ~socket_t();

        void shutdown(bool read, bool write);
        int send(const std::string &buf);
        std::string recv();
        int sendto(const std::string &buf, const char *host, int port, SOCK_TYPE type);
        recv_data recvfrom();
    protected:
        void *ptr;
};

struct client_t : public socket_t
{
    void connect(const char *host, int port, SOCK_TYPE type);
};

struct server_t : public socket_t
{
    void bind(const char *host, int port, SOCK_TYPE type);
    void listen();
    void listen(int backlog);
    void accept();
};